<?php
namespace jy_yiliao;
defined('BY_JYA') or exit('error');
/*
	大夫
*/
class worker extends \plugin{
	/*
		同步客户
	*/
	public function upmy_user($mid=0,$bodyid=0,$workerid=0){
		$isadd=$this->pdo_get('worker_user',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$mid,'bodyid'=>$bodyid,'workerid'=>$workerid));
		if(!$isadd){
			$data=array(
				'uniacid'=>$_SESSION['uniacid'],
				'mid'=>$mid,
				'bodyid'=>$bodyid,
				'workerid'=>$workerid,
				'createtime'=>TIMESTAMP,
			);
			$this->pdo_insert('worker_user',$data);
		}
		return true;
	}
	public function upmy_userlog($id=0,$type=0){
		$user=$this->pdo_get('worker_user',array('uniacid'=>$_SESSION['uniacid'],'id'=>$id));
		$data=array(
				'uniacid'=>$_SESSION['uniacid'],
				'mid'=>$user['mid'],
				'type'=>$type,
				'workerid'=>$user['workerid'],
				'bodyid'=>$user['bodyid'],
				'msg'=>$type?'用药提醒':'复诊提醒',
				'createtime'=>TIMESTAMP,
		);
		$this->pdo_insert('worker_userlog',$data);
		return true;
	}
}